<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Nginx Upstream模块深度解析 | 技术小馆</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css">
    <link rel="stylesheet" href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            color: #333;
            line-height: 1.8;
            background-color: #f8f9fa;
        }
        .serif {
            font-family: 'Noto Serif SC', serif;
        }
        .hero-gradient {
            background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
        }
        .code-block {
            background-color: #2d3748;
            color: #e2e8f0;
            border-radius: 0.5rem;
            overflow-x: auto;
        }
        .card-hover {
            transition: all 0.3s ease;
        }
        .card-hover:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
        }
        .section-anchor {
            position: relative;
            top: -100px;
            visibility: hidden;
        }
        .mermaid {
            background-color: white;
            padding: 1.5rem;
            border-radius: 0.5rem;
            box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
        }
        .highlight {
            position: relative;
        }
        .highlight::before {
            content: "";
            position: absolute;
            left: -0.5rem;
            top: 0;
            height: 100%;
            width: 4px;
            background-color: #2563eb;
            border-radius: 2px;
        }
    </style>
</head>
<body>
    <!-- Hero Section -->
    <section class="hero-gradient text-white py-20 md:py-32 px-6 md:px-0">
        <div class="container mx-auto max-w-5xl text-center">
            <div class="flex justify-center mb-6">
                <span class="px-4 py-1 bg-white bg-opacity-20 rounded-full text-sm font-medium">负载均衡</span>
            </div>
            <h1 class="text-4xl md:text-6xl font-bold mb-6 serif">Nginx Upstream模块深度解析</h1>
            <p class="text-xl md:text-2xl opacity-90 max-w-3xl mx-auto">探索高性能反向代理背后的负载均衡机制与实现原理</p>
            <div class="mt-10 flex justify-center space-x-4">
                <a href="#overview" class="px-6 py-3 bg-white text-blue-900 font-medium rounded-lg hover:bg-opacity-90 transition duration-300">
                    <i class="fas fa-book-open mr-2"></i>开始阅读
                </a>
                <a href="#mermaid-chart" class="px-6 py-3 bg-transparent border border-white text-white font-medium rounded-lg hover:bg-white hover:bg-opacity-10 transition duration-300">
                    <i class="fas fa-project-diagram mr-2"></i>图表概览
                </a>
            </div>
        </div>
    </section>

    <!-- Table of Contents -->
    <section class="py-12 bg-white">
        <div class="container mx-auto max-w-5xl px-6">
            <div class="bg-blue-50 p-6 rounded-xl">
                <h2 class="text-2xl font-bold mb-4 text-blue-900 serif">目录导航</h2>
                <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
                    <a href="#overview" class="flex items-center p-3 bg-white rounded-lg hover:shadow-md transition duration-300">
                        <div class="bg-blue-100 text-blue-600 p-2 rounded-lg mr-4">
                            <i class="fas fa-info-circle"></i>
                        </div>
                        <div>
                            <h3 class="font-medium">模块概述</h3>
                            <p class="text-sm text-gray-600">Upstream模块的基本概念与用途</p>
                        </div>
                    </a>
                    <a href="#definition" class="flex items-center p-3 bg-white rounded-lg hover:shadow-md transition duration-300">
                        <div class="bg-green-100 text-green-600 p-2 rounded-lg mr-4">
                            <i class="fas fa-code"></i>
                        </div>
                        <div>
                            <h3 class="font-medium">定义Upstream块</h3>
                            <p class="text-sm text-gray-600">配置语法与最佳实践</p>
                        </div>
                    </a>
                    <a href="#algorithms" class="flex items-center p-3 bg-white rounded-lg hover:shadow-md transition duration-300">
                        <div class="bg-purple-100 text-purple-600 p-2 rounded-lg mr-4">
                            <i class="fas fa-random"></i>
                        </div>
                        <div>
                            <h3 class="font-medium">负载均衡算法</h3>
                            <p class="text-sm text-gray-600">7种核心算法深度解析</p>
                        </div>
                    </a>
                    <a href="#failover" class="flex items-center p-3 bg-white rounded-lg hover:shadow-md transition duration-300">
                        <div class="bg-red-100 text-red-600 p-2 rounded-lg mr-4">
                            <i class="fas fa-shield-alt"></i>
                        </div>
                        <div>
                            <h3 class="font-medium">故障转移机制</h3>
                            <p class="text-sm text-gray-600">高可用性保障方案</p>
                        </div>
                    </a>
                </div>
            </div>
        </div>
    </section>

    <!-- Main Content -->
    <main class="py-12">
        <div class="container mx-auto max-w-5xl px-6">
            <!-- Overview Section -->
            <div class="mb-20">
                <div id="overview" class="section-anchor"></div>
                <div class="flex items-center mb-6">
                    <h2 class="text-3xl font-bold text-gray-900 serif">upstream模块概述</h2>
                    <span class="ml-4 px-3 py-1 bg-blue-100 text-blue-800 rounded-full text-sm font-medium">核心概念</span>
                </div>
                <p class="text-lg text-gray-700 mb-8"><span class="font-bold text-blue-600">Nginx</span>的<code class="bg-gray-100 px-2 py-1 rounded">upstream</code>模块是实现负载均衡的重要组件，它允许用户将请求分发到多个后端服务器，从而提升系统的可扩展性和高可用性。</p>
                
                <div class="grid grid-cols-1 md:grid-cols-2 gap-8 mb-10">
                    <div class="bg-white p-6 rounded-xl shadow-sm card-hover">
                        <div class="flex items-center mb-4">
                            <div class="bg-blue-100 p-2 rounded-lg text-blue-600 mr-3">
                                <i class="fas fa-balance-scale"></i>
                            </div>
                            <h3 class="font-bold text-lg">主要用途</h3>
                        </div>
                        <ul class="space-y-3">
                            <li class="flex items-start">
                                <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                                <span><span class="font-medium">负载均衡:</span> 平衡请求负载，防止单台服务器过载</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                                <span><span class="font-medium">高可用性:</span> 实现故障转移，确保系统在部分服务器故障时仍能正常工作</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                                <span><span class="font-medium">可扩展性:</span> 通过增加服务器来扩展系统处理能力</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                                <span><span class="font-medium">健康检查:</span> 定期检测后端服务器的健康状态</span>
                            </li>
                        </ul>
                    </div>
                    <div class="bg-white p-6 rounded-xl shadow-sm card-hover">
                        <img src="https://cdn.nlark.com/yuque/0/2024/png/21449790/1725692637048-1c8663bf-2c32-4d64-aaf8-56517a972c65.png" alt="Upstream模块示意图" class="w-full h-auto rounded-lg">
                    </div>
                </div>

                <div class="mb-10">
                    <h3 class="text-xl font-bold mb-4 text-gray-800 serif">配置示例</h3>
                    <div class="code-block p-4 mb-6 rounded-lg">
                        <pre class="text-sm"><code>upstream my_app {
    server 192.168.1.1 weight=3;
    server 192.168.1.2 weight=2;
    server 192.168.1.3;
}</code></pre>
                    </div>
                    <p class="text-gray-700">这个示例配置了一个名为 <code class="bg-gray-100 px-1 py-0.5 rounded">my_app</code> 的 <code class="bg-gray-100 px-1 py-0.5 rounded">upstream</code> 块，包含三台后端服务器，其中第一台服务器的权重为 3，第二台服务器的权重为 2，第三台服务器的权重为 1。</p>
                </div>
            </div>

            <!-- Definition Section -->
            <div class="mb-20">
                <div id="definition" class="section-anchor"></div>
                <div class="flex items-center mb-6">
                    <h2 class="text-3xl font-bold text-gray-900 serif">定义upstream块</h2>
                    <span class="ml-4 px-3 py-1 bg-green-100 text-green-800 rounded-full text-sm font-medium">配置指南</span>
                </div>
                <p class="text-lg text-gray-700 mb-8">在 Nginx 中，<code class="bg-gray-100 px-2 py-1 rounded">upstream</code> 块是用于配置和管理一组后端服务器的核心组件。它允许 Nginx 将客户端请求分发到这些后端服务器，从而实现负载均衡、故障转移和扩展等功能。</p>

                <div class="grid grid-cols-1 md:grid-cols-2 gap-8 mb-10">
                    <div>
                        <h3 class="text-xl font-bold mb-4 text-gray-800 serif">基本结构</h3>
                        <p class="text-gray-700 mb-4"><code class="bg-gray-100 px-2 py-1 rounded">upstream</code> 块用于定义一个后端服务器组，在 Nginx 配置文件中，通常位于 <code class="bg-gray-100 px-1 py-0.5 rounded">http</code> 块内部。</p>
                        <div class="code-block p-4 rounded-lg mb-6">
                            <pre class="text-sm"><code>upstream &lt;name&gt; {
    server &lt;server1&gt;;
    server &lt;server2&gt;;
    ...
}</code></pre>
                        </div>
                    </div>
                    <div>
                        <h3 class="text-xl font-bold mb-4 text-gray-800 serif">结合proxy_pass使用</h3>
                        <p class="text-gray-700 mb-4"><code class="bg-gray-100 px-2 py-1 rounded">upstream</code> 块定义的服务器组通过 <code class="bg-gray-100 px-1 py-0.5 rounded">proxy_pass</code> 指令与客户端请求的反向代理配置结合使用。</p>
                        <div class="code-block p-4 rounded-lg">
                            <pre class="text-sm"><code>location / {
    proxy_pass http://my_backend;
}</code></pre>
                        </div>
                    </div>
                </div>

                <div class="bg-white p-6 rounded-xl shadow-sm mb-10 card-hover">
                    <div class="flex items-center mb-4">
                        <div class="bg-green-100 p-2 rounded-lg text-green-600 mr-3">
                            <i class="fas fa-cog"></i>
                        </div>
                        <h3 class="font-bold text-lg">高级配置选项</h3>
                    </div>
                    <div class="grid grid-cols-1 md:grid-cols-3 gap-4">
                        <div class="p-3 bg-gray-50 rounded-lg">
                            <div class="flex items-center mb-2">
                                <i class="fas fa-heartbeat text-red-500 mr-2"></i>
                                <h4 class="font-medium">健康检查</h4>
                            </div>
                            <p class="text-sm text-gray-600">在 Nginx 开源版本中，可通过第三方模块实现健康检查</p>
                        </div>
                        <div class="p-3 bg-gray-50 rounded-lg">
                            <div class="flex items-center mb-2">
                                <i class="fas fa-user-lock text-purple-500 mr-2"></i>
                                <h4 class="font-medium">会话保持</h4>
                            </div>
                            <p class="text-sm text-gray-600">使用 sticky 模块或 IP 哈希算法来实现会话保持</p>
                        </div>
                        <div class="p-3 bg-gray-50 rounded-lg">
                            <div class="flex items-center mb-2">
                                <i class="fas fa-sync-alt text-blue-500 mr-2"></i>
                                <h4 class="font-medium">动态更新</h4>
                            </div>
                            <p class="text-sm text-gray-600">配置可以在运行时动态更新，无需重启服务</p>
                        </div>
                    </div>
                </div>

                <div>
                    <img src="https://cdn.nlark.com/yuque/0/2024/png/21449790/1725692694394-9c901e5d-0fda-41b3-9d02-8548cd0eaafc.png" alt="Upstream块定义示意图" class="w-full h-auto rounded-lg">
                </div>
            </div>

            <!-- Algorithms Section -->
            <div class="mb-20">
                <div id="algorithms" class="section-anchor"></div>
                <div class="flex items-center mb-6">
                    <h2 class="text-3xl font-bold text-gray-900 serif">负载均衡算法</h2>
                    <span class="ml-4 px-3 py-1 bg-purple-100 text-purple-800 rounded-full text-sm font-medium">7种核心算法</span>
                </div>
                <p class="text-lg text-gray-700 mb-8">负载均衡算法是网络和系统设计中的关键组成部分，用于将客户端请求分配到多个后端服务器，以实现性能优化、资源利用最大化以及高可用性。</p>

                <div class="grid grid-cols-1 md:grid-cols-2 gap-6 mb-10">
                    <div class="bg-white p-6 rounded-xl shadow-sm card-hover">
                        <div class="flex items-center mb-3">
                            <div class="bg-purple-100 p-2 rounded-lg text-purple-600 mr-3">
                                <i class="fas fa-retweet"></i>
                            </div>
                            <h3 class="font-bold text-lg">轮询 (Round Robin)</h3>
                        </div>
                        <p class="text-gray-700 mb-3">最常用算法，按顺序将请求逐个分发到后端服务器</p>
                        <div class="flex flex-wrap gap-2">
                            <span class="px-2 py-1 bg-green-100 text-green-800 text-xs rounded-full">简单易用</span>
                            <span class="px-2 py-1 bg-yellow-100 text-yellow-800 text-xs rounded-full">不考虑服务器负载</span>
                        </div>
                    </div>
                    <div class="bg-white p-6 rounded-xl shadow-sm card-hover">
                        <div class="flex items-center mb-3">
                            <div class="bg-purple-100 p-2 rounded-lg text-purple-600 mr-3">
                                <i class="fas fa-weight-hanging"></i>
                            </div>
                            <h3 class="font-bold text-lg">加权轮询 (Weighted Round Robin)</h3>
                        </div>
                        <p class="text-gray-700 mb-3">在轮询基础上引入权重概念，权重高的服务器接收更多请求</p>
                        <div class="flex flex-wrap gap-2">
                            <span class="px-2 py-1 bg-green-100 text-green-800 text-xs rounded-full">灵活分配</span>
                            <span class="px-2 py-1 bg-yellow-100 text-yellow-800 text-xs rounded-full">配置复杂</span>
                        </div>
                    </div>
                    <div class="bg-white p-6 rounded-xl shadow-sm card-hover">
                        <div class="flex items-center mb-3">
                            <div class="bg-purple-100 p-2 rounded-lg text-purple-600 mr-3">
                                <i class="fas fa-link"></i>
                            </div>
                            <h3 class="font-bold text-lg">最少连接 (Least Connections)</h3>
                        </div>
                        <p class="text-gray-700 mb-3">将请求分配给当前连接数最少的服务器</p>
                        <div class="flex flex-wrap gap-2">
                            <span class="px-2 py-1 bg-green-100 text-green-800 text-xs rounded-full">适合负载不均</span>
                            <span class="px-2 py-1 bg-yellow-100 text-yellow-800 text-xs rounded-full">动态连接挑战</span>
                        </div>
                    </div>
                    <div class="bg-white p-6 rounded-xl shadow-sm card-hover">
                        <div class="flex items-center mb-3">
                            <div class="bg-purple-100 p-2 rounded-lg text-purple-600 mr-3">
                                <i class="fas fa-fingerprint"></i>
                            </div>
                            <h3 class="font-bold text-lg">IP 哈希 (IP Hash)</h3>
                        </div>
                        <p class="text-gray-700 mb-3">根据客户端 IP 地址哈希值分配请求，实现会话保持</p>
                        <div class="flex flex-wrap gap-2">
                            <span class="px-2 py-1 bg-green-100 text-green-800 text-xs rounded-full">会话保持</span>
                            <span class="px-2 py-1 bg-yellow-100 text-yellow-800 text-xs rounded-full">故障问题</span>
                        </div>
                    </div>
                </div>

                <div class="mb-10">
                    <h3 class="text-xl font-bold mb-4 text-gray-800 serif">其他高级算法</h3>
                    <div class="grid grid-cols-1 md:grid-cols-3 gap-4">
                        <div class="bg-white p-4 rounded-lg shadow-sm">
                            <h4 class="font-bold mb-2">最小响应时间</h4>
                            <p class="text-sm text-gray-600">将请求分配给当前响应时间最短的服务器</p>
                        </div>
                        <div class="bg-white p-4 rounded-lg shadow-sm">
                            <h4 class="font-bold mb-2">加权最少连接</h4>
                            <p class="text-sm text-gray-600">结合权重和连接数进行精确分配</p>
                        </div>
                        <div class="bg-white p-4 rounded-lg shadow-sm">
                            <h4 class="font-bold mb-2">基于内容的路由</h4>
                            <p class="text-sm text-gray-600">根据请求内容路由到不同服务器</p>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Mermaid Diagram -->
            <div id="mermaid-chart" class="section-anchor"></div>
            <div class="mb-20">
                <div class="flex items-center mb-6">
                    <h2 class="text-3xl font-bold text-gray-900 serif">Upstream模块架构图</h2>
                    <span class="ml-4 px-3 py-1 bg-indigo-100 text-indigo-800 rounded-full text-sm font-medium">可视化</span>
                </div>
                <div class="mermaid">
                    graph TD
                        A[客户端请求] --> B[Nginx]
                        B -->|负载均衡| C[Upstream模块]
                        C --> D1[服务器1]
                        C --> D2[服务器2]
                        C --> D3[服务器3]
                        C --> D4[服务器4]
                        style A fill:#f0f9ff,stroke:#2563eb
                        style B fill:#eff6ff,stroke:#1d4ed8
                        style C fill:#e0f2fe,stroke:#0369a1
                        style D1 fill:#f0fdf4,stroke:#16a34a
                        style D2 fill:#f0fdf4,stroke:#16a34a
                        style D3 fill:#f0fdf4,stroke:#16a34a
                        style D4 fill:#f0fdf4,stroke:#16a34a
                </div>
            </div>

            <!-- Failover Section -->
            <div class="mb-20">
                <div id="failover" class="section-anchor"></div>
                <div class="flex items-center mb-6">
                    <h2 class="text-3xl font-bold text-gray-900 serif">故障转移机制</h2>
                    <span class="ml-4 px-3 py-1 bg-red-100 text-red-800 rounded-full text-sm font-medium">高可用性</span>
                </div>
                <p class="text-lg text-gray-700 mb-8">在Nginx的<code class="bg-gray-100 px-2 py-1 rounded">upstream</code>模块中，故障转移机制是实现高可用性和负载均衡的重要组成部分，确保流量能够自动转移到其他健康的服务器。</p>

                <div class="bg-white p-6 rounded-xl shadow-sm mb-10 card-hover">
                    <div class="flex items-center mb-4">
                        <div class="bg-red-100 p-2 rounded-lg text-red-600 mr-3">
                            <i class="fas fa-shield-alt"></i>
                        </div>
                        <h3 class="font-bold text-lg">故障转移机制</h3>
                    </div>
                    <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
                        <div>
                            <h4 class="font-bold mb-2 text-gray-800">1. 服务器健康检查</h4>
                            <p class="text-gray-700 mb-4">Nginx通过健康检查机制监控后端服务器的健康状态，无法正常响应的服务器将被标记为不可用。</p>
                            <div class="code-block p-4 rounded-lg mb-4">
                                <pre class="text-sm"><code>upstream backend {
    server server1 max_fails=3 fail_timeout=30s;
    server server2;
}</code></pre>
                            </div>
                        </div>
                        <div>
                            <h4 class="font-bold mb-2 text-gray-800">2. 备份服务器配置</h4>
                            <p class="text-gray-700 mb-4">使用<code class="bg-gray-100 px-1 py-0.5 rounded">backup</code>指令配置备用服务器，这些服务器在所有主服务器故障时才会接收请求。</p>
                            <div class="code-block p-4 rounded-lg">
                                <pre class="text-sm"><code>upstream backend {
    server server1;
    server server2 backup;
}</code></pre>
                            </div>
                        </div>
                    </div>
                </div>

                <div>
                    <h3 class="text-xl font-bold mb-4 text-gray-800 serif">故障转移的挑战与解决方案</h3>
                    <div class="grid grid-cols-1 md:grid-cols-3 gap-4 mb-6">
                        <div class="bg-white p-4 rounded-lg shadow-sm">
                            <h4 class="font-bold mb-2">故障检测延迟</h4>
                            <p class="text-sm text-gray-600">可能导致请求丢失，需部署实时监控系统</p>
                        </div>
                        <div class="bg-white p-4 rounded-lg shadow-sm">
                            <h4 class="font-bold mb-2">数据一致性</h4>
                            <p class="text-sm text-gray-600">使用数据同步机制确保主备服务器一致性</p>
                        </div>
                        <div class="bg-white p-4 rounded-lg shadow-sm">
                            <h4 class="font-bold mb-2">配置复杂性</h4>
                            <p class="text-sm text-gray-600">使用配置管理工具简化配置过程</p>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Health Check Section -->
            <div>
                <div id="healthcheck" class="section-anchor"></div>
                <div class="flex items-center mb-6">
                    <h2 class="text-3xl font-bold text-gray-900 serif">健康检查机制</h2>
                    <span class="ml-4 px-3 py-1 bg-teal-100 text-teal-800 rounded-full text-sm font-medium">稳定性保障</span>
                </div>
                <p class="text-lg text-gray-700 mb-8">健康检查是确保负载均衡服务器集群稳定性和高可用性的重要机制，主要用于实时监控后端服务器的状态，以确保流量仅分发到健康的服务器上。</p>

                <div class="grid grid-cols-1 md:grid-cols-2 gap-8 mb-10">
                    <div>
                        <h3 class="text-xl font-bold mb-4 text-gray-800 serif">被动健康检查</h3>
                        <p class="text-gray-700 mb-4">基于服务器实际处理请求的结果来评估其健康状态，如响应超时或返回错误时标记为不可用。</p>
                        <div class="code-block p-4 rounded-lg">
                            <pre class="text-sm"><code>upstream backend {
    server server1 max_fails=3 fail_timeout=30s;
    server server2;
}</code></pre>
                        </div>
                    </div>
                    <div>
                        <h3 class="text-xl font-bold mb-4 text-gray-800 serif">主动健康检查</h3>
                        <p class="text-gray-700 mb-4">通过发送预定义的健康检查请求来定期检查后端服务器的状态（通常需要第三方模块支持）。</p>
                        <div class="code-block p-4 rounded-lg">
                            <pre class="text-sm"><code>upstream backend {
    server server1;
    server server2;
    
    health_check interval=10s timeout=3s;
}</code></pre>
                        </div>
                    </div>
                </div>

                <div class="bg-white p-6 rounded-xl shadow-sm">
                    <div class="flex items-center mb-4">
                        <div class="bg-teal-100 p-2 rounded-lg text-teal-600 mr-3">
                            <i class="fas fa-lightbulb"></i>
                        </div>
                        <h3 class="font-bold text-lg">健康检查的优化策略</h3>
                    </div>
                    <div class="grid grid-cols-1 md:grid-cols-3 gap-4">
                        <div class="p-3 bg-gray-50 rounded-lg">
                            <div class="flex items-center mb-2">
                                <i class="fas fa-clock text-blue-500 mr-2"></i>
                                <h4 class="font-medium">调整检查频率</h4>
                            </div>
                            <p class="text-sm text-gray-600">根据系统负载和业务需求调整健康检查的频率和超时设置</p>
                        </div>
                        <div class="p-3 bg-gray-50 rounded-lg">
                            <div class="flex items-center mb-2">
                                <i class="fas fa-exclamation-triangle text-yellow-500 mr-2"></i>
                                <h4 class="font-medium">减少误报</h4>
                            </div>
                            <p class="text-sm text-gray-600">合理配置检查参数来减少误报和漏报的概率</p>
                        </div>
                        <div class="p-3 bg-gray-50 rounded-lg">
                            <div class="flex items-center mb-2">
                                <i class="fas fa-server text-green-500 mr-2"></i>
                                <h4 class="font-medium">资源管理</h4>
                            </div>
                            <p class="text-sm text-gray-600">使用合理的检查频率平衡资源消耗和健康检查有效性</p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </main>

    <!-- Footer -->
    <footer class="bg-gray-900 text-white py-10">
        <div class="container mx-auto max-w-5xl px-6">
            <div class="flex flex-col md:flex-row justify-between items-center">
                <div class="mb-4 md:mb-0">
                    <h3 class="text-xl font-bold">技术小馆</h3>
                    <p class="text-gray-400">探索技术奥秘，分享知识价值</p>
                </div>
                <div>
                    <a href="http://www.yuque.com/jtostring" class="hover:text-blue-400 transition duration-300">
                        <i class="fas fa-globe mr-2"></i>http://www.yuque.com/jtostring
                    </a>
                </div>
            </div>
            <div class="border-t border-gray-800 mt-8 pt-8 text-center text-gray-400 text-sm">
                <p>© 2024 技术小馆. 保留所有权利.</p>
            </div>
        </div>
    </footer>

    <script>
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            flowchart: {
                useMaxWidth: true,
                htmlLabels: true,
                curve: 'basis'
            }
        });
    </script>
</body>
</html>